<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>文件列表展示</title>
</head>
<body>
<div align="center">
    <a href="${ctx}/index.jsp">返回主页</a>
</div><br>
<table align="center" border="2">
    <thead>
    <tr>
        <th>文件标题</th>
        <th>文件大小</th>
        <th>下载次数</th>
        <th>更新时间</th>
        <th>详情</th>
        <th>下载</th>
        <th>删除</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${filesList}" var="file">
        <tr>
            <td>${file.fileName}</td>
            <td><span style="color:orangered">${file.fileSize} </span>KB</td>
            <td><span style="color:dodgerblue">${file.downloadCount}</span>  次</td>
            <td>${file.uploadTime}</td>
            <td><a href="${ctx}/user/viewPic?id=${file.id}">查看详情</a></td>
            <td><a href="${ctx}/download/downloadFile?id=${file.id}">下载文件</a></td>
            <td><a href="#" onclick="deleteFile('${file.id}')">删除文件</a></td>
        </tr>
    </c:forEach>
    </tbody>
</table>

<script type="text/javascript">
    function deleteFile(id) {
        if (confirm("请确认是否删除？")){
            window.location.href="${ctx}/download/deleteThisFile?id="+id
        }
     }
</script>

</body>
</html>
